﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using COM.OA.BLL;
using COM.OA.Entity;
using System.Collections.Generic;

public partial class linminchao_bbs_lt_delelt : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        users loginuser = Session["loginuser"] as users;
        if (loginuser == null)
        {
            this.Response.Write(string.Format(GetRedirect.ALLREDIRECT, "../../login.aspx"));
        }
        else
        {
            int i = Int32.Parse(this.Request.QueryString["id"]);
            String where = "br_bbs_id='{0}'";
            where = string.Format(where, i);
            IList<bbsrevert> brIlist = bbsrevertBLL.Select(where);
            if (brIlist.Count != 0)
            {
                IList<bbsrevert> brlist = bbsrevertBLL.Select(where);
                foreach (bbsrevert brr in brlist)
                {
                    bbsrevertBLL.Delete(brr);
                }
                bbs bb = bbsBLL.Select(i);
                int iii = bbsBLL.Delete(bb);
                if (iii < 0)
                {
                    this.Response.Write(string.Format(GetRedirect.WINALERT, "删除帖子成功！"));
                    this.Response.Write(string.Format(GetRedirect.REDIRECT, "lt_lookbbs.aspx"));
                }
                else
                {
                    this.Response.Write(string.Format(GetRedirect.WINALERT, "删除帖子失败！"));
                }
            }
            else
            {
                int iii = bbsBLL.Delete(i);
                if (iii < 0)
                {
                    this.Response.Write(string.Format(GetRedirect.WINALERT, "删除帖子成功！"));
                    this.Response.Write(string.Format(GetRedirect.REDIRECT, "lt_lookbbs.aspx"));
                }
                else
                {
                    this.Response.Write(string.Format(GetRedirect.WINALERT, "删除帖子失败！"));
                }
            }
        }
    }
}
